import { dataQueryAxios, datashopAxios } from '@/utils/request'

// 筛选项列表
export const filtersList = (params: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/release-items/${params.id}/filters`,
    method: 'get',
    params
  })
}

// 数据库列表
export const SelectDatesList = (): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/release-items/with-topics`,
    method: 'get'
  })
}

// 收藏筛选列表
export const queryList = (params: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/favorites/filters`,
    method: 'get',
    params
  })
}

// 收藏筛选
export const favoritesquery = (data: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/favorites/filters`,
    method: 'post',
    data
  })
}
// 火石数据库列表
export const DatabaseList = (data: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/data-items/search/${data.id}`,
    method: 'post',
    data
  })
}

// 火石数据库列表title
export const Databasetitle = (id: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v4/data-item-products/${id}/columns`,
    method: 'get',
    params: {
      page: 1,
      page_size: 199
    }
  }).then((res) => res.items)
}

// 火石数据库列表排序规则
export const Databasesort_rules = (params: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/release-items/${params.id}/sort_rules`,
    method: 'get',
    params
  })
}

// 国民经济四级联动列表
export const national_economy_classification = (): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/options/national-economy-classification`,
    method: 'get'
  })
}

// 战略性新兴产业分类
export const strategy_classification = (): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/options/strategy-classification`,
    method: 'get'
  })
}

// 收藏数据
export const Databasetfavorites = (data: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/favorites/data`,
    method: 'post',
    data
  })
}
// 收藏数据
export const deleteDatabasetfavorites = (params: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/favorites/data/${params.release_item_id}/${params.data_id}`,
    method: 'delete'
  })
}
// 关联关系项列表
export const DataBasetRelease_items = (params: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/release-items/${params.release_item_id}/relations`,
    method: 'get',
    params
  })
}

// 数据库查询导出
export const DataBasetexport = (data: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/data-items/search/${data.query.release_item_id}/:export`,
    method: 'post',
    data
  })
}

// 聚合筛选项选项值
export const getDataItemPolymerizeOptions = (params: any): Promise<any> => {
  return dataQueryAxios({
    url: `/api/data-query/v1/release-items/${params.id}/filters/polymerize-option`,
    method: 'get',
    params
  })
}
